GetMenuHandle
You can use the GetMenuHandle function to get a handle to the menu record of any of your application's menus other than its Help menu. (Use the HMGetHelpMenuHandle function to get a handle to the menu record of your application's Help menu.) The GetMenuHandle function is also available as the GetMHandle function.
FUNCTION GetMenuHandle (menuID: Integer): MenuHandle;
menuID
- The menu ID of the menu. (Note that this is not the resource ID,
although you often assign the menu ID so that it matches the resource ID.) You assign a menu ID in the 'MENU' resource of a menu. If you
do not define your menus in 'MENU' resources, you can assign a menu
ID using NewMenu.
DESCRIPTION
The GetMenuHandle function returns a handle to the menu record of the menu having the specified menu ID. If the menu is in the current menu list, GetMenuHandle returns a handle to the menu record of the menu as its function result. Otherwise, GetMenuHandle returns NIL as its function result.
SPECIAL CONSIDERATIONS
To get a handle to a menu record of a pop-up menu that you create using the pop-up control definition function, dereference the cntrlData field of the pop-up menu's control record instead of using GetMenuHandle.